package view;

import java.awt.event.KeyEvent;

import javax.swing.Action;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

/**
 * Class for the user menus.
 * @author Sarah George
 * @version Autumn 2012
 */
@SuppressWarnings("serial")
public class UserMenus extends JMenuBar {

	/**
	 * Field for the File menu.
	 */
	private final JMenu my_file = new JMenu("File");

	/**
	 * Field for the help menu.
	 */
	private final JMenu my_help = new JMenu("Help");

	/**
	 * The constructor for the menus.
	 */
	public UserMenus() {
		super();
		setupMenus();
	}

	/**
	 * Method to set up the menus.
	 */
	private void setupMenus() {
		add(my_file);
		my_file.setMnemonic(KeyEvent.VK_F);
		add(my_help);
		my_help.setMnemonic(KeyEvent.VK_H);
	}

	/**
	 * Creates the file menu buttons.
	 * @param an_action the array of actions for the file menu
	 */
	public void createFileMenuBarButton(final Action[] an_action) {
		for (Action act : an_action) {
			final JMenuItem file_button = new JMenuItem(act);
			my_file.add(file_button);
		}
	}

	/**
	 * Method to add an about menu item in the help menu.
	 * @param a_help_click when about is clicked on an option pane appears.
	 */
	public void createHelpMenuBarButton(final Action a_help_click) {
		final JMenuItem help_button = new JMenuItem(a_help_click);
		my_help.add(help_button);
	}
} //End class user menus.